home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / wgdb-42.lha / wgdb-4.2 / gdb / gdb.info-5 < prev    next >
Text File  |  1992-09-11  |  49KB  |  1,274 lines

  1. Info file gdb.info, produced by Makeinfo, -*- Text -*- from input
  2. file gdb-all.texi.
  3.  
  4.    This file documents the GNU debugger GDB.
  5.  
  6.    Copyright (C) 1988, 1989, 1990, 1991 Free Software Foundation, Inc.
  7.  
  8.    Permission is granted to make and distribute verbatim copies of
  9. this
  10. manual provided the copyright notice and this permission notice are
  11. preserved on all copies.
  12.  
  13.    Permission is granted to copy and distribute modified versions of
  14. this
  15. manual under the conditions for verbatim copying, provided also that
  16. the section entitled "GNU General Public License" is included
  17. exactly as in the original, and provided that the entire resulting
  18. derived work is distributed under the terms of a permission notice
  19. identical to this one.
  20.  
  21.    Permission is granted to copy and distribute translations of this
  22. manual into another language, under the above conditions for
  23. modified versions, except that the section entitled "GNU General
  24. Public License" may be included in a translation approved by the
  25. Free Software Foundation instead of in the original English.
  26.  
  27. 
  28. File: gdb.info,  Node: Files,  Next: Symbol Errors,  Prev: GDB Files,  Up: GDB Files
  29.  
  30. Commands to Specify Files
  31. =========================
  32.  
  33.    GDB needs to know the file name of the program to be debugged,
  34. both in order to read its symbol table and in order to start the
  35. program.  To debug a core dump of a previous run, GDB must be told
  36. the file name of the core dump.
  37.  
  38.    The usual way to specify the executable and core dump file names
  39. is with the command arguments given when you start GDB, as discussed
  40. in *note Invocation::..
  41.  
  42.    Occasionally it is necessary to change to a different file during
  43. a GDB session.  Or you may run GDB and forget to specify the files
  44. you want to use.  In these situations the GDB commands to specify
  45. new files are useful.
  46.  
  47. `file FILENAME'
  48.      Use FILENAME as the program to be debugged.  It is read for its
  49.      symbols and for the contents of pure memory.  It is also the
  50.      program executed when you use the `run' command.  If you do not
  51.      specify a directory and the file is not found in GDB's working
  52.      directory,
  53.  
  54.      GDB uses the environment variable `PATH' as a list of
  55.      directories to search, just as the shell does when looking for
  56.      a
  57.      program to run.  You can change the value of this variable, for
  58.      both GDB and your program, using the `path' command.
  59.  
  60. `file'
  61.      `file' with no argument makes GDB discard any information it has
  62.      on both executable file and the symbol table.
  63.  
  64. `exec-file [ FILENAME ]'
  65.      Specify that the program to be run (but not the symbol table) is
  66.      found in FILENAME.  GDB will search the environment variable
  67.      `PATH' if necessary to locate the program.  Omitting FILENAME
  68.      means to discard information on the executable file.
  69.  
  70. `symbol-file [ FILENAME ]'
  71.      Read symbol table information from file FILENAME.  `PATH' is
  72.      searched when necessary.  Use the `file' command to get both
  73.      symbol table and program to run from the same file.
  74.  
  75.      `symbol-file' with no argument clears out GDB's information on
  76.      your program's symbol table.
  77.  
  78.      The `symbol-file' command causes GDB to forget the contents of
  79.      its convenience variables, the value history, and all
  80.      breakpoints and auto-display expressions.  This is because they
  81.     
  82.      may contain pointers to the internal data recording symbols and
  83.      data types, which are part of the old symbol table data being
  84.      discarded inside GDB.
  85.  
  86.      `symbol-file' will not repeat if you press RET again after
  87.      executing it once.
  88.  
  89.      On some kinds of object files, the `symbol-file' command does
  90.      not actually read the symbol table in full right away. 
  91.      Instead, it scans the symbol table quickly to find which source
  92.      files and which symbols are present.  The details are read
  93.      later, one source file at a time, when they are needed.
  94.  
  95.      The purpose of this two-stage reading strategy is to make GDB
  96.      start up faster.  For the most part, it is invisible except for
  97.      occasional pauses while the symbol table details for a
  98.      particular source file are being read.  (The `set verbose'
  99.      command can turn these pauses into messages if desired. *Note
  100.      Messages/Warnings::).
  101.  
  102.      When the symbol table is stored in COFF format, `symbol-file'
  103.      does read the symbol table data in full right away.  We haven't
  104.      implemented the two-stage strategy for COFF yet.
  105.  
  106.      When GDB is configured for a particular environment, it will
  107.      understand debugging information in whatever format is the
  108.      standard generated for that environment; you may use either a
  109.      GNU compiler, or other compilers that adhere to the local
  110.      conventions.  Best results are usually obtained from GNU
  111.      compilers; for example, using `gcc' you can generate debugging
  112.      information for optimized code.
  113.  
  114. `core-file [ FILENAME ]'
  115.      Specify the whereabouts of a core dump file to be used as the
  116.      "contents of memory".  Traditionally, core files contain only
  117.      some parts of the address space of the process that generated
  118.      them; GDB can access the executable file itself for other parts.
  119.  
  120.      `core-file' with no argument specifies that no core file is to
  121.      be used.
  122.  
  123.      Note that the core file is ignored when your program is actually
  124.      running under GDB.  So, if you have been running the program
  125.      and you wish to debug a core file instead, you must kill the
  126.      subprocess in which the program is running.  To do this, use
  127.      the `kill' command (*note Kill Process::.).
  128.  
  129. `load FILENAME'
  130.      Depending on what remote debugging facilities are configured
  131.      into GDB, the `load' command may be available.  Where it
  132.      exists, it is meant to make FILENAME (an executable) available
  133.      for debugging on the remote system--by downloading, or dynamic
  134.      linking, for example.  `load' also records FILENAME's symbol
  135.      table in GDB, like the `add-symbol-file' command.
  136.  
  137.      If `load' is not available on your GDB, attempting to execute it
  138.      gets the error message "`You can't do that when your target is
  139.      ...'"
  140.  
  141.      On VxWorks, `load' will dynamically link FILENAME on the current
  142.      target system as well as adding its symbols in GDB.
  143.  
  144.      With the Nindy interface to an Intel 960 board, `load' will
  145.      download FILENAME to the 960 as well as adding its symbols in
  146.      GDB.
  147.  
  148.      `load' will not repeat if you press RET again after using it.
  149.  
  150. `add-symbol-file FILENAME ADDRESS'
  151.      The `add-symbol-file' command reads additional symbol table
  152.      information from the file FILENAME.  You would use this command
  153.      when FILENAME has been dynamically loaded (by some other means)
  154.      into the program that is running.  ADDRESS should be the memory
  155.      address at which the file has been loaded; GDB cannot figure
  156.      this out for itself.
  157.  
  158.      The symbol table of the file FILENAME is added to the symbol
  159.      table originally read with the `symbol-file' command.  You can
  160.      use the `add-symbol-file' command any number of times; the new
  161.      symbol data thus read keeps adding to the old.  To discard all
  162.      old symbol data instead, use the `symbol-file' command.
  163.  
  164.      `add-symbol-file' will not repeat if you press RET after using it.
  165.  
  166. `info files'
  167. `info target'
  168.      `info files' and `info target' are synonymous; both print the
  169.      current targets (*note Targets::.), including the names of the
  170.      executable and core dump files currently in use by GDB, and the
  171.      files from which symbols were loaded.  The command `help
  172.      targets' lists all possible targets rather than current ones.
  173.  
  174.    All file-specifying commands allow both absolute and relative file
  175. names as arguments.  GDB always converts the file name to an
  176. absolute path name and remembers it that way.
  177.  
  178.    GDB supports the SunOS shared library format.  GDB automatically
  179. loads symbol definitions from shared libraries when you use the
  180. `run' command, or when you examine a core file.  (Before you issue
  181. the `run' command, GDB won't understand references to a function in
  182. a shared library, however--unless you're debugging a core file).
  183.  
  184. `info share'
  185. `info sharedlibrary'
  186.      Print the names of the shared libraries which are currently
  187.      loaded.
  188.  
  189. `sharedlibrary REGEX'
  190. `share REGEX'
  191.      This is an obsolescent command; you can use it to explicitly
  192.      load shared object library symbols for files matching a UNIX
  193.      regular expression, but as with files loaded automatically, it
  194.      will only load shared libraries required by your program for a
  195.      core file or after typing `run'.  If REGEX is omitted all
  196.      shared libraries required by your program are loaded.
  197.  
  198. 
  199. File: gdb.info,  Node: Symbol Errors,  Prev: Files,  Up: GDB Files
  200.  
  201. Errors Reading Symbol Files
  202. ===========================
  203.  
  204.    While reading a symbol file, GDB will occasionally encounter
  205. problems, such as symbol types it does not recognize, or known bugs
  206. in compiler output.  By default, GDB does not notify you of such
  207. problems, since they're relatively common and primarily of interest
  208. to people debugging compilers.  If you are interested in seeing
  209. information about ill-constructed symbol tables, you can either ask
  210. GDB to print only one message about each such type of problem, no
  211. matter how many times the problem occurs; or you can ask GDB to
  212. print more messages, to see how many times the problems occur, with
  213. the `set complaints' command (*Note Messages/Warnings::).
  214.  
  215.    The messages currently printed, and their meanings, are:
  216.  
  217. `inner block not inside outer block in SYMBOL'
  218.      The symbol information shows where symbol scopes begin and end
  219.      (such as at the start of a function or a block of statements). 
  220.      This error indicates that an inner scope block is not fully
  221.      contained in its outer scope blocks.
  222.  
  223.      GDB circumvents the problem by treating the inner block as if it
  224.      had the same scope as the outer block.  In the error message,
  225.      SYMBOL may be shown as "`(don't know)'" if the outer block is
  226.      not a function.
  227.  
  228. `block at ADDRESS out of order'
  229.      The symbol information for symbol scope blocks should occur in
  230.      order of increasing addresses.  This error indicates that it
  231.      does not do so.
  232.  
  233.      GDB does not circumvent this problem, and will have trouble
  234.      locating symbols in the source file whose symbols being read. 
  235.      (You can often determine what source file is affected by
  236.      specifying `set verbose on'.  *Note Messages/Warnings::.)
  237.  
  238. `bad block start address patched'
  239.      The symbol information for a symbol scope block has a start
  240.      address smaller than the address of the preceding source line. 
  241.      This is known to occur in the SunOS 4.1.1 (and earlier) C
  242.      compiler.
  243.  
  244.      GDB circumvents the problem by treating the symbol scope block
  245.      as starting on the previous source line.
  246.  
  247. `bad string table offset in symbol N'
  248.      Symbol number N contains a pointer into the string table which
  249.      is larger than the size of the string table.
  250.  
  251.      GDB circumvents the problem by considering the symbol to have
  252.      the name `foo', which may cause other problems if many symbols
  253.      end up with this name.
  254.  
  255. `unknown symbol type `0xNN''
  256.      The symbol information contains new data types that GDB does not
  257.      yet know how to read.  `0xNN' is the symbol type of the
  258.      misunderstood information, in hexadecimal.
  259.  
  260.      GDB circumvents the error by ignoring this symbol information. 
  261.      This will usually allow the program to be debugged, though
  262.      certain symbols will not be accessible.  If you encounter such
  263.      a problem and feel like debugging it, you can debug `gdb' with
  264.      itself, breakpoint on `complain', then go up to the function
  265.      `read_dbx_symtab' and examine `*bufp' to see the symbol.
  266.  
  267. `stub type has NULL name'
  268.      GDB could not find the full definition for a struct or class.
  269.  
  270. `const/volatile indicator missing (ok if using g++ v1.x), got...'
  271.      The symbol information for a C++ member function is missing some
  272.      information that recent versions of the compiler should have
  273.      output for it.
  274.  
  275. `info mismatch between compiler and debugger'
  276.      GDB could not parse a type specification output by the compiler.
  277.  
  278. 
  279. File: gdb.info,  Node: Targets,  Next: Controlling GDB,  Prev: GDB Files,  Up: Top
  280.  
  281. Specifying a Debugging Target
  282. *****************************
  283.  
  284.    A "target" is the execution environment occupied by your program. 
  285. Often, GDB runs in the same host environment as the program you are
  286. debugging; in that case, the debugging target is specified as a side
  287. effect when you use the `file' or `core' commands.  When you need
  288. more flexibility--for example, running GDB on a physically separate
  289. host, or controlling a standalone system over a serial port or a
  290. realtime system over a TCP/IP connection--you can use the `target'
  291. command to specify one of the target types configured for GDB (*note
  292. Target Commands::.).
  293.  
  294. * Menu:
  295.  
  296. * Active Targets::              Active Targets
  297. * Target Commands::             Commands for Managing Targets
  298. * Remote::                      Remote Debugging
  299.  
  300. 
  301. File: gdb.info,  Node: Active Targets,  Next: Target Commands,  Prev: Targets,  Up: Targets
  302.  
  303. Active Targets
  304. ==============
  305.  
  306.    There are three classes of targets: processes, core files, and
  307. executable files.  GDB can work concurrently on up to three active
  308. targets, one in each class.  This allows you to (for example) start
  309. a process and inspect its activity without abandoning your work on a
  310. core file.
  311.  
  312.    If, for example, you execute `gdb a.out', then the executable file
  313. `a.out' is the only active target.  If you designate a core file as
  314. well--presumably from a prior run that crashed and coredumped--then
  315. GDB has two active targets and will use them in tandem, looking
  316. first in the corefile target, then in the executable file, to
  317. satisfy
  318. requests for memory addresses.  (Typically, these two classes of
  319. target are complementary, since core files contain only the
  320. program's read-write memory--variables and so on--plus machine
  321. status, while executable files contain only the program text and
  322. initialized data.)
  323.  
  324.    When you type `run', your executable file becomes an active
  325. process target as well.  When a process target is active, all GDB
  326. commands requesting memory addresses refer to that target; addresses
  327. in an active core file or executable file target are obscured while
  328. the process target is active.
  329.  
  330.    Use the `core-file', and `exec-file' commands to select a new core
  331. file or executable target (*note Files::.).  To specify as a target
  332. a process that's already running, use the `attach' command (*note
  333. Attach::.).
  334.  
  335. 
  336. File: gdb.info,  Node: Target Commands,  Next: Remote,  Prev: Active Targets,  Up: Targets
  337.  
  338. Commands for Managing Targets
  339. =============================
  340.  
  341. `target TYPE PARAMETERS'
  342.      Connects the GDB host environment to a target machine or
  343.      process.  A target is typically a protocol for talking to
  344.     
  345.      debugging facilities.  You use the argument TYPE to specify the
  346.      type or protocol of the target machine.
  347.  
  348.      Further PARAMETERS are interpreted by the target protocol, but
  349.      typically include things like device names or host names to
  350.      connect with, process numbers, and baud rates.
  351.  
  352.      The `target' command will not repeat if you press RET again
  353.      after executing the command.
  354.  
  355. `help target'
  356.      Displays the names of all targets available.  To display targets
  357.      currently selected, use either `info target' or `info files'
  358.      (*note Files::.).
  359.  
  360. `help target NAME'
  361.      Describe a particular target, including any parameters necessary
  362.      to select it.
  363.  
  364.    Here are some common targets (available, or not, depending on the
  365. GDB configuration):
  366.  
  367. `target exec PROG'
  368.      An executable file.  `target exec PROG' is the same as
  369.      `exec-file PROG'.
  370.  
  371. `target core FILENAME'
  372.      A core dump file.  `target core FILENAME' is the same as
  373.      `core-file FILENAME'.
  374.  
  375. `target remote DEV'
  376.      Remote serial target in GDB-specific protocol.  The argument DEV
  377.      specifies what serial device to use for the connection (e.g. 
  378.      `/dev/ttya'). *Note Remote::.
  379.  
  380. `target amd-eb DEV SPEED PROG'
  381.      Remote PC-resident AMD EB29K board, attached over serial lines. 
  382.      DEV is the serial device, as for `target remote'; SPEED allows
  383.      you to specify the linespeed; and PROG is the name of the
  384.      program to be debugged, as it appears to DOS on the PC.  *Note
  385.      EB29K Remote::.
  386.  
  387. `target nindy DEVICENAME'
  388.      An Intel 960 board controlled by a Nindy Monitor.  DEVICENAME is
  389.      the name of the serial device to use for the connection, e.g. 
  390.      `/dev/ttya'.  *Note i960-Nindy Remote::.
  391.  
  392. `target vxworks MACHINENAME'
  393.      A VxWorks system, attached via TCP/IP.  The argument MACHINENAME
  394.      is the target system's machine name or IP address.  *Note
  395.      VxWorks Remote::.
  396.  
  397.    Different targets are available on different configurations of
  398. GDB; your configuration may have more or fewer targets.
  399.  
  400. 
  401. File: gdb.info,  Node: Remote,  Prev: Target Commands,  Up: Targets
  402.  
  403. Remote Debugging
  404. ================
  405.  
  406. * Menu:
  407.  
  408. * i960-Nindy Remote::        GDB with a Remote i960 (Nindy)
  409. * EB29K Remote::        GDB with a Remote EB29K
  410. * VxWorks Remote::        GDB and VxWorks
  411.  
  412.    If you are trying to debug a program running on a machine that
  413. can't run GDB in the usual way, it is often useful to use remote
  414. debugging.  For example, you might use remote debugging on an
  415. operating system kernel, or on a small system which does not have a
  416. general purpose operating system powerful enough to run a
  417. full-featured
  418. debugger.
  419.  
  420.    Some configurations of GDB have special serial or TCP/IP
  421. interfaces to make this work with particular debugging targets.  In
  422. addition,
  423. GDB comes with a generic serial protocol (specific to GDB, but not
  424. specific to any particular target system) which you can use if you
  425. write the remote stubs--the code that will run on the remote system
  426. to
  427. communicate with GDB.
  428.  
  429.    To use the GDB remote serial protocol, the program to be debugged
  430. on the remote machine needs to contain a debugging stub which talks
  431. to GDB over the serial line.  Several working remote stubs are
  432. distributed with GDB; see the `README' file in the GDB distribution
  433. for more information.
  434.  
  435.    For details of this communication protocol, see the comments in
  436. the GDB source file `remote.c'.
  437.  
  438.    To start remote debugging, first run GDB and specify as an
  439. executable file the program that is running in the remote machine. 
  440. This tells GDB how to find the program's symbols and the contents of
  441. its pure text.  Then establish communication using the `target
  442. remote' command with a device name as an argument.  For example:
  443.  
  444.      target remote /dev/ttyb
  445.  
  446. if the serial line is connected to the device named `/dev/ttyb'. 
  447. This will stop the remote machine if it is not already stopped.
  448.  
  449.    Now you can use all the usual commands to examine and change data
  450. and to step and continue the remote program.
  451.  
  452.    To resume the remote program and stop debugging it, use the
  453. `detach' command.
  454.  
  455.    Other remote targets may be available in your configuration of
  456. GDB; use `help targets' to list them.
  457.  
  458. 
  459. File: gdb.info,  Node: i960-Nindy Remote,  Next: EB29K Remote,  Prev: Remote,  Up: Remote
  460.  
  461. GDB with a Remote i960 (Nindy)
  462. ------------------------------
  463.  
  464.    "Nindy" is a ROM Monitor program for Intel 960 target systems. 
  465. When GDB is configured to control a remote Intel 960 using Nindy,
  466. you can tell GDB how to connect to the 960 in several ways:
  467.  
  468.    * Through command line options specifying serial port, version of
  469.      the Nindy protocol, and communications speed;
  470.  
  471.    * By responding to a prompt on startup;
  472.  
  473.    * By using the `target' command at any point during your GDB
  474.      session.  *Note Target Commands::.
  475.  
  476. * Menu:
  477.  
  478. * Nindy Startup::               Startup with Nindy
  479. * Nindy Options::               Options for Nindy
  480. * Nindy reset::                 Nindy Reset Command
  481.  
  482. 
  483. File: gdb.info,  Node: Nindy Startup,  Next: Nindy Options,  Prev: i960-Nindy Remote,  Up: i960-Nindy Remote
  484.  
  485. Startup with Nindy
  486. ..................
  487.  
  488.    If you simply start `GDB' without using any command-line options,
  489. you are prompted for what serial port to use, *before* you reach the
  490. ordinary GDB prompt:
  491.  
  492.      Attach /dev/ttyNN -- specify NN, or "quit" to quit:
  493.  
  494. Respond to the prompt with whatever suffix (after `/dev/tty')
  495. identifies the serial port you want to use.  You can, if you choose,
  496. simply start up with no Nindy connection by responding to the prompt
  497. with an empty line.  If you do this, and later wish to attach to
  498. Nindy, use `target' (*note Target Commands::.).
  499.  
  500. 
  501. File: gdb.info,  Node: Nindy Options,  Next: Nindy reset,  Prev: Nindy Startup,  Up: i960-Nindy Remote
  502.  
  503. Options for Nindy
  504. .................
  505.  
  506.    These are the startup options for beginning your GDB session with
  507. a Nindy-960 board attached:
  508.  
  509. `-r PORT'
  510.      Specify the serial port name of a serial interface to be used to
  511.      connect to the target system.  This option is only available
  512.      when GDB is configured for the Intel 960 target architecture. 
  513.      You may specify PORT as any of: a full pathname (e.g. `-r
  514.      /dev/ttya'), a device name in `/dev' (e.g. `-r ttya'), or
  515.      simply
  516.      the unique suffix for a specific `tty' (e.g. `-r a').
  517.  
  518. `-O'
  519.      (An uppercase letter "O", not a zero.)  Specify that GDB should
  520.      use the "old" Nindy monitor protocol to connect to the target
  521.      system.  This option is only available when GDB is configured
  522.      for the Intel 960 target architecture.
  523.  
  524.           *Warning:* if you specify `-O', but are actually trying to
  525.           connect to a target system that expects the newer
  526.           protocol, the connection will fail, appearing to be a
  527.           speed mismatch.  GDB will repeatedly attempt to reconnect
  528.           at several different line speeds.  You can abort this
  529.          
  530.           process with an interrupt.
  531.  
  532. `-brk'
  533.      Specify that GDB should first send a `BREAK' signal to the
  534.      target system, in an attempt to reset it, before connecting to
  535.      a Nindy target.
  536.  
  537.           *Warning:* Many target systems do not have the hardware
  538.           that this requires; it only works with a few boards.
  539.  
  540.    The standard `-b' option controls the line speed used on the
  541. serial port.
  542.  
  543. 
  544. File: gdb.info,  Node: Nindy reset,  Prev: Nindy Options,  Up: i960-Nindy Remote
  545.  
  546. Nindy Reset Command
  547. ...................
  548.  
  549. `reset'
  550.      For a Nindy target, this command sends a "break" to the remote
  551.      target system; this is only useful if the target has been
  552.      equipped with a circuit to perform a hard reset (or some other
  553.      interesting action) when a break is detected.
  554.  
  555. 
  556. File: gdb.info,  Node: EB29K Remote,  Next: VxWorks Remote,  Prev: i960-Nindy Remote,  Up: Remote
  557.  
  558. GDB with a Remote EB29K
  559. -----------------------
  560.  
  561.    To use GDB from a Unix system to run programs on AMD's EB29K board
  562. in a PC, you must first connect a serial cable between the PC and a
  563. serial port on the Unix system.  In the following, we assume you've
  564. hooked the cable between the PC's `COM1' port and `/dev/ttya' on the
  565. Unix system.
  566.  
  567. * Menu:
  568.  
  569. * Comms (EB29K)::               Communications Setup
  570. * gdb-EB29K::                   EB29K cross-debugging
  571. * Remote Log::                  Remote Log
  572.  
  573. 
  574. File: gdb.info,  Node: Comms (EB29K),  Next: gdb-EB29K,  Prev: EB29K Remote,  Up: EB29K Remote
  575.  
  576. Communications Setup
  577. ....................
  578.  
  579.    The next step is to set up the PC's port, by doing something like
  580. the following in DOS on the PC:
  581.  
  582.      C:\> MODE com1:9600,n,8,1,none
  583.  
  584. This example--run on an MS DOS 4.0 system--sets the PC port to 9600
  585. bps, no parity, eight data bits, one stop bit, and no "retry"
  586. action; you must match the communications parameters when
  587. establishing the Unix end of the connection as well.
  588.  
  589.    To give control of the PC to the Unix side of the serial line,
  590. type the following at the DOS console:
  591.  
  592.      C:\> CTTY com1
  593.  
  594. (Later, if you wish to return control to the DOS console, you can use
  595. the command `CTTY con'--but you must send it over the device that
  596. had control, in our example over the `COM1' serial line).
  597.  
  598.    From the Unix host, use a communications program such as `tip' or
  599. `cu' to communicate with the PC; for example,
  600.  
  601.      cu -s 9600 -l /dev/ttya
  602.  
  603. The `cu' options shown specify, respectively, the linespeed and the
  604. serial port to use.  If you use `tip' instead, your command line may
  605. look something like the following:
  606.  
  607.      tip -9600 /dev/ttya
  608.  
  609. Your system may define a different name where our example uses
  610. `/dev/ttya' as the argument to `tip'.  The communications
  611. parameters, including what port to use, are associated with the
  612. `tip' argument in the "remote" descriptions file--normally the
  613. system table `/etc/remote'.
  614.  
  615.    Using the `tip' or `cu' connection, change the DOS working
  616. directory to the directory containing a copy of your 29K program,
  617. then start the PC program `EBMON' (an EB29K control program supplied
  618. with your board by AMD).  You should see an initial display from
  619. `EBMON' similar to the one that follows, ending with the `EBMON'
  620. prompt `#'--
  621.  
  622.      C:\> G:
  623.      
  624.      G:\> CD \usr\joe\work29k
  625.      
  626.      G:\USR\JOE\WORK29K> EBMON
  627.      Am29000 PC Coprocessor Board Monitor, version 3.0-18
  628.      Copyright 1990 Advanced Micro Devices, Inc.
  629.      Written by Gibbons and Associates, Inc.
  630.      
  631.      Enter '?' or 'H' for help
  632.      
  633.      PC Coprocessor Type   = EB29K
  634.      I/O Base              = 0x208
  635.      Memory Base           = 0xd0000
  636.      
  637.      Data Memory Size      = 2048KB
  638.      Available I-RAM Range = 0x8000 to 0x1fffff
  639.      Available D-RAM Range = 0x80002000 to 0x801fffff
  640.      
  641.      PageSize              = 0x400
  642.      Register Stack Size   = 0x800
  643.      Memory Stack Size     = 0x1800
  644.      
  645.      CPU PRL               = 0x3
  646.      Am29027 Available     = No
  647.      Byte Write Available  = Yes
  648.      
  649.      # ~.
  650.  
  651.    Then exit the `cu' or `tip' program (done in the example by typing
  652. `~.' at the `EBMON' prompt).  `EBMON' will keep running, ready for
  653. GDB to take over.
  654.  
  655.    For this example, we've assumed what is probably the most
  656. convenient way to make sure the same 29K program is on both the PC
  657. and the Unix system: a PC/NFS connection that establishes "drive
  658. `G:'" on the PC as a file system on the Unix host.  If you don't
  659. have PC/NFS or something similar connecting the two systems, you
  660. must arrange some other way--perhaps floppy-disk transfer--of
  661. getting
  662. the 29K program from the Unix system to the PC; GDB will *not*
  663. download it over the serial line.
  664.  
  665. 
  666. File: gdb.info,  Node: gdb-EB29K,  Next: Remote Log,  Prev: Comms (EB29K),  Up: EB29K Remote
  667.  
  668. EB29K cross-debugging
  669. .....................
  670.  
  671.    Finally, `cd' to the directory containing an image of your 29K
  672. program on the Unix system, and start GDB--specifying as argument
  673. the name of your 29K program:
  674.  
  675.      cd /usr/joe/work29k
  676.      gdb myfoo
  677.  
  678.    Now you can use the `target' command:
  679.  
  680.      target amd-eb /dev/ttya 9600 MYFOO
  681.  
  682. In this example, we've assumed your program is in a file called
  683. `myfoo'.  Note that the filename given as the last argument to
  684. `target amd-eb' should be the name of the program as it appears to
  685. DOS.  In our example this is simply `MYFOO', but in general it can
  686. include a DOS path, and depending on your transfer mechanism may not
  687. resemble the name on the Unix side.
  688.  
  689.    At this point, you can set any breakpoints you wish; when you're
  690. ready to see your program run on the 29K board, use the GDB command
  691. `run'.
  692.  
  693.    To stop debugging the remote program, use the GDB `detach'
  694. command.
  695.  
  696.    To return control of the PC to its console, use `tip' or `cu' once
  697. again,
  698. after your GDB session has concluded, to attach to `EBMON'.  You can
  699. then type the command `q' to shut down `EBMON', returning control to
  700. the DOS command-line interpreter.  Type `CTTY con' to return command
  701. input to the main DOS console, and type `~.' to leave `tip' or `cu'.
  702.  
  703. 
  704. File: gdb.info,  Node: Remote Log,  Prev: gdb-EB29K,  Up: EB29K Remote
  705.  
  706. Remote Log
  707. ..........
  708.  
  709.    The `target amd-eb' command creates a file `eb.log' in the current
  710. working directory, to help debug problems with the connection. 
  711. `eb.log' records all the output from `EBMON', including echoes of
  712. the commands sent to it.  Running `tail -f' on this file in another
  713. window often helps to understand trouble with `EBMON', or unexpected
  714. events on the PC side of the connection.
  715.  
  716. 
  717. File: gdb.info,  Node: VxWorks Remote,  Prev: EB29K Remote,  Up: Remote
  718.  
  719. GDB and VxWorks
  720. ---------------
  721.  
  722.    GDB enables developers to spawn and debug tasks running on
  723. networked VxWorks targets from a Unix host.  Already-running tasks
  724. spawned from the VxWorks shell can also be debugged.  GDB uses code
  725. that
  726. runs on both the UNIX host and on the VxWorks target.  The program
  727. `gdb' is installed and executed on the UNIX host.
  728.  
  729.    The remote debugging interface (RDB) routines are installed and
  730. executed on the VxWorks target.  These routines are included in the
  731. VxWorks library `rdb.a' and are incorporated into the system image
  732. when source-level debugging is enabled in the VxWorks configuration.
  733.  
  734.    Defining `INCLUDE_RDB' in the VxWorks configuration file
  735. `configAll.h' includes the RDB interface routines and spawns the
  736. source debugging task `tRdbTask' when VxWorks is booted.  For more
  737. information on configuring and remaking VxWorks, see the `VxWorks
  738. Programmer's Guide'.
  739.  
  740.    Once you have included the RDB interface in your VxWorks system
  741. image and set your Unix execution search path to find GDB, you are
  742. ready to run GDB.  From your UNIX host, type:
  743.  
  744.      % gdb
  745.  
  746.    GDB will come up showing the prompt:
  747.  
  748.      (gdb)
  749.  
  750. * Menu:
  751.  
  752. * VxWorks connection::          Connecting to VxWorks
  753. * VxWorks download::            VxWorks Download
  754. * VxWorks attach::              Running Tasks
  755.  
  756. 
  757. File: gdb.info,  Node: VxWorks connection,  Next: VxWorks download,  Prev: VxWorks Remote,  Up: VxWorks Remote
  758.  
  759. Connecting to VxWorks
  760. .....................
  761.  
  762.    The GDB command `target' lets you connect to a VxWorks target on
  763. the network.  To connect to a target whose host name is "`tt'", type:
  764.  
  765.      (gdb) target vxworks tt
  766.  
  767.    GDB will display a message similar to the following:
  768.  
  769.      Attaching remote machine across net... Success!
  770.  
  771.    GDB will then attempt to read the symbol tables of any object
  772. modules loaded into the VxWorks target since it was last booted. 
  773. GDB locates these files by searching the directories listed in the
  774. command search path (*note Environment::.); if it fails to find an
  775. object file, it will display a message such as:
  776.  
  777.      prog.o: No such file or directory.
  778.  
  779.    This will cause the `target' command to abort.  When this happens,
  780. you should add the appropriate directory to the search path, with
  781. the GDB command `path', and execute the `target' command again.
  782.  
  783. 
  784. File: gdb.info,  Node: VxWorks download,  Next: VxWorks attach,  Prev: VxWorks connection,  Up: VxWorks Remote
  785.  
  786. VxWorks Download
  787. ................
  788.  
  789.    If you have connected to the VxWorks target and you want to debug
  790. an object that has not yet been loaded, you can use the GDB `load'
  791. command to download a file from UNIX to VxWorks incrementally.  The
  792. object file given as an argument to the `load' command is actually
  793. opened twice: first by the VxWorks target in order to download the
  794. code, then by GDB in order to read the symbol table.  This can lead
  795. to problems if the current working directories on the two systems
  796. differ.  It is simplest to set the working directory on both systems
  797. to the directory in which the object file resides, and then to
  798. reference the file by its name, without any path.  Thus, to load a
  799. program `prog.o', residing in `wherever/vw/demo/rdb', on VxWorks type:
  800.  
  801.      -> cd "wherever/vw/demo/rdb"
  802.  
  803.    On GDB type:
  804.  
  805.      (gdb) cd wherever/vw/demo/rdb 
  806.      (gdb) load prog.o
  807.  
  808.    GDB will display a response similar to the following:
  809.  
  810.      Reading symbol data from wherever/vw/demo/rdb/prog.o... done.
  811.  
  812.    You can also use the `load' command to reload an object module
  813. after
  814. editing and recompiling the corresponding source file.  Note that
  815. this will cause GDB to delete all currently-defined breakpoints,
  816. auto-displays, and convenience variables, and to clear the value
  817. history.  (This is necessary in order to preserve the integrity of
  818. debugger data structures that reference the target system's symbol
  819. table.)
  820.  
  821. 
  822. File: gdb.info,  Node: VxWorks attach,  Prev: VxWorks download,  Up: VxWorks Remote
  823.  
  824. Running Tasks
  825. .............
  826.  
  827.    You can also attach to an existing task using the `attach' command
  828. as follows:
  829.  
  830.      (gdb) attach TASK
  831.  
  832.    where TASK is the VxWorks hexadecimal task ID.  The task can be
  833. running or suspended when you attach to it.  If running, it will be
  834. suspended
  835. at the time of attachment.
  836.  
  837. 
  838. File: gdb.info,  Node: Controlling GDB,  Next: Sequences,  Prev: Targets,  Up: Top
  839.  
  840. Controlling GDB
  841. ***************
  842.  
  843.    You can alter many aspects of GDB's interaction with you by using
  844. the `set' command.  For commands controlling how GDB displays data,
  845. *note Print Settings::.; other settings are described here.
  846.  
  847. * Menu:
  848.  
  849. * Prompt::                      Prompt
  850. * Editing::                     Command Editing
  851. * History::                     Command History
  852. * Screen Size::                 Screen Size
  853. * Numbers::                     Numbers
  854. * Messages/Warnings::           Optional Warnings and Messages
  855.  
  856. 
  857. File: gdb.info,  Node: Prompt,  Next: Editing,  Prev: Controlling GDB,  Up: Controlling GDB
  858.  
  859. Prompt
  860. ======
  861.  
  862.    GDB indicates its readiness to read a command by printing a string
  863. called the "prompt".  This string is normally `(gdb)'.  You can
  864. change the prompt string with the `set prompt' command.  For
  865. instance, when debugging GDB with GDB, it is useful to change the
  866. prompt in one of the GDBs so that you can always tell which one you
  867. are talking to.
  868.  
  869. `set prompt NEWPROMPT'
  870.      Directs GDB to use NEWPROMPT as its prompt string henceforth.
  871.  
  872. `show prompt'
  873.      Prints a line of the form: `Gdb's prompt is: YOUR-PROMPT'
  874.  
  875. 
  876. File: gdb.info,  Node: Editing,  Next: History,  Prev: Prompt,  Up: Controlling GDB
  877.  
  878. Command Editing
  879. ===============
  880.  
  881.    GDB reads its input commands via the "readline" interface.  This
  882. GNU library provides consistent behavior for programs which provide
  883. a command line interface to the user.  Advantages are `emacs'-style
  884. or `vi'-style inline editing of commands, `csh'-like history
  885. substitution, and a storage and recall of command history across
  886. debugging sessions.
  887.  
  888.    You may control the behavior of command line editing in GDB with
  889. the command `set'.
  890.  
  891. `set editing'
  892. `set editing on'
  893.      Enable command line editing (enabled by default).
  894.  
  895. `set editing off'
  896.      Disable command line editing.
  897.  
  898. `show editing'
  899.      Show whether command line editing is enabled.
  900.  
  901. 
  902. File: gdb.info,  Node: History,  Next: Screen Size,  Prev: Editing,  Up: Controlling GDB
  903.  
  904. Command History
  905. ===============
  906.  
  907. `set history filename FNAME'
  908.      Set the name of the GDB command history file to FNAME.  This is
  909.      the file from which GDB will read an initial command history
  910.      list or to which it will write this list when it exits.  This
  911.      list is accessed through history expansion or through the
  912.      history command editing characters listed below.  This file
  913.      defaults to the value of the environment variable
  914.      `GDBHISTFILE', or to `./.gdb_history' if this variable is not
  915.      set.
  916.  
  917. `set history save'
  918. `set history save on'
  919.      Record command history in a file, whose name may be specified
  920.      with the `set history filename' command.  By default, this
  921.      option is disabled.
  922.  
  923. `set history save off'
  924.      Stop recording command history in a file.
  925.  
  926. `set history size SIZE'
  927.      Set the number of commands which GDB will keep in its history
  928.      list.  This defaults to the value of the environment variable
  929.      `HISTSIZE', or to 256 if this variable is not set.
  930.  
  931.    History expansion assigns special meaning to the character `!'. 
  932. Since `!' is also the logical not operator in C, history expansion
  933. is off by default. If you decide to enable history expansion with
  934. the `set history expansion on' command, you may sometimes need to
  935. follow `!' (when it is used as logical not, in an expression) with a
  936. space or a tab to prevent it from being expanded.  The readline
  937. history facilities will not attempt substitution on the strings `!='
  938. and `!(', even when history expansion is enabled.
  939.  
  940.    The commands to control history expansion are:
  941.  
  942. `set history expansion on'
  943. `set history expansion'
  944.      Enable history expansion.  History expansion is off by default.
  945.  
  946. `set history expansion off'
  947.      Disable history expansion.
  948.  
  949.      The readline code comes with more complete documentation of
  950.      editing and history expansion features.  Users unfamiliar with
  951.      `emacs' or `vi' may wish to read it.
  952.  
  953. `show history'
  954. `show history filename'
  955. `show history save'
  956. `show history size'
  957. `show history expansion'
  958.      These commands display the state of the GDB history parameters. 
  959.      `show history' by itself displays all four states.
  960.  
  961. `show commands'
  962.      Display the last ten commands in the command history.
  963.  
  964. `show commands N'
  965.      Print ten commands centered on command number N.
  966.  
  967. `show commands +'
  968.      Print ten commands just after the commands last printed.
  969.  
  970. 
  971. File: gdb.info,  Node: Screen Size,  Next: Numbers,  Prev: History,  Up: Controlling GDB
  972.  
  973. Screen Size
  974. ===========
  975.  
  976.    Certain commands to GDB may produce large amounts of information
  977. output to the screen.  To help you read all of it, GDB pauses and
  978. asks you for input at the end of each page of output.  Type RET when
  979. you want to continue the output.  GDB also uses the screen width
  980. setting to determine when to wrap lines of output.  Depending on
  981. what is being printed, it tries to break the line at a readable
  982. place, rather than simply letting it overflow onto the following line.
  983.  
  984.    Normally GDB knows the size of the screen from the termcap data
  985. base together with the value of the `TERM' environment variable and
  986. the `stty rows' and `stty cols' settings. If this is not correct,
  987. you can override it with the `set height' and `set width' commands:
  988.  
  989. `set height LPP'
  990. `show height'
  991. `set width CPL'
  992. `show width'
  993.      These `set' commands specify a screen height of LPP lines and a
  994.      screen width of CPL characters.  The associated `show' commands
  995.      display the current settings.
  996.  
  997.      If you specify a height of zero lines, GDB will not pause during
  998.      output no matter how long the output is.  This is useful if
  999.      output is to a file or to an editor buffer.
  1000.  
  1001. 
  1002. File: gdb.info,  Node: Numbers,  Next: Messages/Warnings,  Prev: Screen Size,  Up: Controlling GDB
  1003.  
  1004. Numbers
  1005. =======
  1006.  
  1007.    You can always enter numbers in octal, decimal, or hexadecimal in
  1008. GDB by the usual conventions: octal numbers begin with `0', decimal
  1009. numbers end with `.', and hexadecimal numbers begin with `0x'. 
  1010. Numbers that begin with none of these are, by default, entered in
  1011. base 10; likewise, the default display for numbers--when no
  1012. particular format is specified--is base 10.  You can change the
  1013. default base for both input and output with the `set radix' command.
  1014.  
  1015. `set radix BASE'
  1016.      Set the default base for numeric input and display.  Supported
  1017.      choices for BASE are decimal 2, 8, 10, 16.  BASE must itself be
  1018.      specified either unambiguously or using the current default
  1019.      radix; for example, any of
  1020.  
  1021.           set radix 1010
  1022.           set radix 012
  1023.           set radix 10.
  1024.           set radix 0xa
  1025.  
  1026.      will set the base to decimal.  On the other hand, `set radix 10'
  1027.      will leave the radix unchanged no matter what it was.
  1028.  
  1029. `show radix'
  1030.      Display the current default base for numeric input and display.
  1031.  
  1032. 
  1033. File: gdb.info,  Node: Messages/Warnings,  Prev: Numbers,  Up: Controlling GDB
  1034.  
  1035. Optional Warnings and Messages
  1036. ==============================
  1037.  
  1038.    By default, GDB is silent about its inner workings.  If you are
  1039. running on a slow machine, you may want to use the `set verbose'
  1040. command.  It will make GDB tell you when it does a lengthy internal
  1041. operation, so you won't think it has crashed.
  1042.  
  1043.    Currently, the messages controlled by `set verbose' are those
  1044. which announce that the symbol table for a source file is being read
  1045. (*note Files::., in the description of the command `symbol-file').
  1046.  
  1047. `set verbose on'
  1048.      Enables GDB's output of certain informational messages.
  1049.  
  1050. `set verbose off'
  1051.      Disables GDB's output of certain informational messages.
  1052.  
  1053. `show verbose'
  1054.      Displays whether `set verbose' is on or off.
  1055.  
  1056.    By default, if GDB encounters bugs in the symbol table of an
  1057. object file, it is silent; but if you are debugging a compiler, you
  1058. may find this information useful (*note Symbol Errors::.).
  1059.  
  1060. `set complaints LIMIT'
  1061.      Permits GDB to output LIMIT complaints about each type of
  1062.      unusual symbols before becoming silent about the problem.  Set
  1063.      LIMIT to zero to suppress all complaints; set it to a large
  1064.      number to prevent complaints from being suppressed.
  1065.  
  1066. `show complaints'
  1067.      Displays how many symbol complaints GDB is permitted to produce.
  1068.  
  1069.    By default, GDB is cautious, and asks what sometimes seem to be a
  1070. lot of stupid questions to confirm certain commands.  For example,
  1071. if you try to run a program which is already running:
  1072.  
  1073.      (gdb) run
  1074.      The program being debugged has been started already.
  1075.      Start it from the beginning? (y or n)
  1076.  
  1077.    If you're willing to unflinchingly face the consequences of your
  1078. own
  1079. commands, you can disable this "feature":
  1080.  
  1081. `set confirm off'
  1082.      Disables confirmation requests.
  1083.  
  1084. `set confirm on'
  1085.      Enables confirmation requests (the default).
  1086.  
  1087. `show confirm'
  1088.      Displays state of confirmation requests.
  1089.  
  1090.    Some systems allow individual object files that make up your
  1091. program
  1092. to be replaced without stopping and restarting your program.  For
  1093. example, in VxWorks you can simply recompile a defective object file
  1094. and keep on running.  If you're running on one of these systems, you
  1095. can allow GDB to reload the symbols for automatically relinked
  1096. modules:
  1097.  
  1098. `set symbol-reloading on'
  1099.      Replace symbol definitions for the corresponding source file
  1100.      when an object file with a particular name is seen again.
  1101.  
  1102. `set symbol-reloading off'
  1103.      Don't replace symbol definitions when re-encountering object
  1104.      files of the same name.  This is the default state; if you're
  1105.      not running on a system that permits automatically relinking
  1106.      modules, you should leave `symbol-reloading' off, since
  1107.      otherwise GDB may discard symbols when linking large programs,
  1108.      that may contain several modules (from different directories or
  1109.      libraries) with the same name.
  1110.  
  1111. `show symbol-reloading'
  1112.      Show the current `on' or `off' setting.
  1113.  
  1114. 
  1115. File: gdb.info,  Node: Sequences,  Next: Emacs,  Prev: Controlling GDB,  Up: Top
  1116.  
  1117. Canned Sequences of Commands
  1118. ****************************
  1119.  
  1120.    Aside from breakpoint commands (*note Break Commands::.), GDB
  1121. provides two ways to store sequences of commands for execution as a
  1122. unit: user-defined commands and command files.
  1123.  
  1124. * Menu:
  1125.  
  1126. * Define::                      User-Defined Commands
  1127. * Command Files::               Command Files
  1128. * Output::                      Commands for Controlled Output
  1129.  
  1130. 
  1131. File: gdb.info,  Node: Define,  Next: Command Files,  Prev: Sequences,  Up: Sequences
  1132.  
  1133. User-Defined Commands
  1134. =====================
  1135.  
  1136.    A "user-defined command" is a sequence of GDB commands to which
  1137. you assign a new name as a command.  This is done with the `define'
  1138. command.
  1139.  
  1140. `define COMMANDNAME'
  1141.      Define a command named COMMANDNAME.  If there is already a
  1142.      command by that name, you are asked to confirm that you want to
  1143.      redefine it.
  1144.  
  1145.      The definition of the command is made up of other GDB command
  1146.      lines, which are given following the `define' command.  The end
  1147.      of these commands is marked by a line containing `end'.
  1148.  
  1149. `document COMMANDNAME'
  1150.      Give documentation to the user-defined command COMMANDNAME.  The
  1151.      command COMMANDNAME must already be defined.  This command
  1152.      reads lines of documentation just as `define' reads the lines
  1153.      of the command definition, ending with `end'.  After the
  1154.      `document' command is finished, `help' on command COMMANDNAME
  1155.      will print the documentation you have specified.
  1156.  
  1157.      You may use the `document' command again to change the
  1158.      documentation of a command.  Redefining the command with
  1159.      `define' does not change the documentation.
  1160.  
  1161. `help user-defined'
  1162.      List all user-defined commands, with the first line of the
  1163.      documentation (if any) for each.
  1164.  
  1165. `info user'
  1166. `info user COMMANDNAME'
  1167.      Display the GDB commands used to define COMMANDNAME (but not its
  1168.      documentation).  If no COMMANDNAME is given, display the
  1169.      definitions for all user-defined commands.
  1170.  
  1171.    User-defined commands do not take arguments.  When they are
  1172. executed, the commands of the definition are not printed.  An error
  1173. in any command stops execution of the user-defined command.
  1174.  
  1175.    Commands that would ask for confirmation if used interactively
  1176. proceed without asking when used inside a user-defined command. 
  1177. Many GDB commands that normally print messages to say what they are
  1178. doing omit the messages when used in a user-defined command.
  1179.  
  1180. 
  1181. File: gdb.info,  Node: Command Files,  Next: Output,  Prev: Define,  Up: Sequences
  1182.  
  1183. Command Files
  1184. =============
  1185.  
  1186.    A command file for GDB is a file of lines that are GDB commands. 
  1187. Comments (lines starting with `#') may also be included.  An empty
  1188. line in a command file does nothing; it does not mean to repeat the
  1189. last command, as it would from the terminal.
  1190.  
  1191.    When you start GDB, it automatically executes commands from its
  1192. "init files".  These are files named `.gdbinit'.  GDB reads the init
  1193. file (if any) in your home directory and then the init file (if any)
  1194. in the current working directory.  (The init files are not executed
  1195. if you use the `-nx' option; *note Mode Options::..)  You can also
  1196. request the execution of a command file with the `source' command:
  1197.  
  1198. `source FILENAME'
  1199.      Execute the command file FILENAME.
  1200.  
  1201.    The lines in a command file are executed sequentially.  They are
  1202. not printed as they are executed.  An error in any command
  1203. terminates execution of the command file.
  1204.  
  1205.    Commands that would ask for confirmation if used interactively
  1206. proceed without asking when used in a command file.  Many GDB
  1207. commands that normally print messages to say what they are doing
  1208. omit the messages when called from command files.
  1209.  
  1210. 
  1211. File: gdb.info,  Node: Output,  Prev: Command Files,  Up: Sequences
  1212.  
  1213. Commands for Controlled Output
  1214. ==============================
  1215.  
  1216.    During the execution of a command file or a user-defined command,
  1217. normal GDB output is suppressed; the only output that appears is
  1218. what is explicitly printed by the commands in the definition.  This
  1219. section describes three commands useful for generating exactly the
  1220. output
  1221. you want.
  1222.  
  1223. `echo TEXT'
  1224.      Print TEXT.  Nonprinting characters can be included in TEXT
  1225.      using C escape sequences, such as `\n' to print a newline.  No
  1226.      newline will be printed unless you specify one. In addition to
  1227.      the standard C escape sequences, a backslash followed by a
  1228.      space stands for a space.  This is useful for outputting a
  1229.      string with spaces at the beginning or the end, since leading
  1230.      and trailing spaces are otherwise trimmed from all arguments. 
  1231.      Thus, to print ` and foo = ', use the command `echo \ and foo =
  1232.      \ '.
  1233.  
  1234.      A backslash at the end of TEXT can be used, as in C, to continue
  1235.      the command onto subsequent lines.  For example,
  1236.  
  1237.           echo This is some text\n\
  1238.           which is continued\n\
  1239.           onto several lines.\n
  1240.  
  1241.      produces the same output as
  1242.  
  1243.           echo This is some text\n
  1244.           echo which is continued\n
  1245.           echo onto several lines.\n
  1246.  
  1247. `output EXPRESSION'
  1248.      Print the value of EXPRESSION and nothing but that value: no
  1249.      newlines, no `$NN = '.  The value is not entered in the value
  1250.      history either.  *Note Expressions:: for more information on
  1251.      expressions.
  1252.  
  1253. `output/FMT EXPRESSION'
  1254.      Print the value of EXPRESSION in format FMT.  You can use the
  1255.      same formats as for `print'; *note Output formats::., for more
  1256.      information.
  1257.  
  1258. `printf STRING, EXPRESSIONS...'
  1259.      Print the values of the EXPRESSIONS under the control of STRING.
  1260.      The EXPRESSIONS are separated by commas and may be either
  1261.      numbers or pointers.  Their values are printed as specified by
  1262.      STRING, exactly as if the program were to execute
  1263.  
  1264.           printf (STRING, EXPRESSIONS...);
  1265.  
  1266.      For example, you can print two values in hex like this:
  1267.  
  1268.           printf "foo, bar-foo = 0x%x, 0x%x\n", foo, bar-foo
  1269.  
  1270.      The only backslash-escape sequences that you can use in the
  1271.      format string are the simple ones that consist of backslash
  1272.      followed by a letter.
  1273.  
  1274.